import request from '@/hooks/request'

const Api = {
  xxx: '/platform/wechatRobot/xxx', // 测试promise.all

  getList: '/platform/wechatRobot/getWechatRobotList', // 微信列表
  editRemark: '/platform/wechatRobot/editWechatRobotRemark',
  deleteById: '/robot/wechat/deleteWechatRobot',
  getWechatRobotGroupList: '/platform/wechatRobot/getWechatRobotGroupList', // 分组
  deleteWechatRobotGroup: '/platform/wechatRobot/deleteWechatRobotGroup', // 删除分组
  addWechatRobotGroup: '/platform/wechatRobot/addWechatRobotGroup', // 添加分组
  statisticalMagnitude: '/platform/wechatRobot/statisticalMagnitude', // 状态统计
  wechatRobotAddGroup: '/platform/wechatRobot/wechatRobotAddGroup', // 微信添加到分组
  editGroup: '/platform/wechatRobot/editWechatRobotGroup',
  getUserBalanceRecordList: '/platform/user/getUserBalanceRecordList', // 票大人账户资金记录
  // getUserBalance: '/platform/user/getUserBalance', // 账户余额
  getUserBalance: '/platform/user/getUser', // 账户余额 - 新
  // ------ 闲鱼 ------
  getFishRobotList: '/platform/fish/getFishRobotList', // 闲鱼列表
  getFishRobotGroupList: '/platform/fish/getFishRobotGroupList', // 获取分组列表
  addFishRobotGroup: '/platform/fish/addFishRobotGroup', // 新增分组
  deleteFishRobotGroup: '/platform/fish/deleteFishRobotGroup', // 删除分组
  editFishRobotGroup: '/platform/fish/editFishRobotGroup', // 编辑分组名称
  editFishRobotRemark: '/platform/fish/editFishRobotRemark', // 编辑闲鱼备注
  fishRobotAddGroup: '/platform/fish/fishRobotAddGroup', // 闲鱼添加到分组
  fishStatisticalMagnitude: '/platform/fish/statisticalMagnitude', // 状态统计
  auth: '/platform/fish/auth', // 授权
  getAuthResult: '/platform/fish/getAuthResult', // 确认授权完成接口
  openCard: '/platform/wechatRobot/openCard', // 激活卡密
  editContactInformation: '/platform/user/editContactInformation', // 编辑当前用户的联系方式
  getContactInformation: '/platform/user/getContactInformation', // 查询上级和自己的联系方式
  userBalanceRecordExcelOut: '/platform/user/userBalanceRecordExcelOut', // 导出表格
  robotMoveTime: '/platform/common/robotMoveTime', // 转移时长
  chaYuJia: '/film/identify/getBeforehandQuotationByTask', // 查询预报价
  zhiChuPia: '/film/order/automaticSubmitOrder', // 支付出票
  information: '/platform/notifyMsg/pageListMsgNotify', // 获取消息列表
  infoYiDu: '/platform/notifyMsg/updateStatusMsgNotify', // 消息标记已读
  infoWeiZon: '/platform/notifyMsg/getUnreadCount', // 获取用户未读消息总数
  infoAllDu: '/platform/notifyMsg/updateUserStatusMsgNotifyAll', // 消息标记全部已读
  addMoney: '/platform/alipay/alipayRecharge',// 支付宝 充值 余额
  pedigree: '/platform/user/getParentUserTree', // 用户族谱
}
/** 查询用户族谱 */
export const getChaPedigree = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: Api.pedigree,
    data: parameter,
  })
}


/** 查询预报价 */
export const getChaYu = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    url: Api.chaYuJia,
    data: parameter,
  })
}

/** 支付出票 */
export const getChuPia = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.zhiChuPia,
    data: parameter,
  })
}

/** 获取消息列表 */
export const getInformation = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.information,
    data: parameter,
  })
}

/** 消息标记已读 */
export const getInfoYiDu = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.infoYiDu + `?id=${parameter}`,
  })
}

/** 获取用户未读消息总数 */
export const getInfoWeiZon = () => {
  return request({
    method: 'post',
    url: Api.infoWeiZon,
  })
}

/** 消息标记全部已读 */
export const getInfoAllDu = () => {
  return request({
    method: 'post',
    url: Api.infoAllDu,
  })
}

export const robotMoveTime = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.robotMoveTime,
    data: parameter,
  })
}

export const userBalanceRecordExcelOut = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.userBalanceRecordExcelOut,
    data: parameter,
    responseType: 'blob',
  })
}

export const getContactInformation = () => {
  return request({
    method: 'post',
    url: Api.getContactInformation,
  })
}

export const editContactInformation = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editContactInformation,
    data: parameter,
  })
}

export const xxx = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xxx,
    data: parameter,
  })
}

export const getList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getList,
    data: parameter,
  })
}

export const editRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editRemark,
    data: parameter,
  })
}

export const deleteById = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteById,
    data: formData,
  })
}

export const getWechatRobotGroupList = () => {
  return request({
    method: 'post',
    url: Api.getWechatRobotGroupList,
  })
}

export const deleteWechatRobotGroup = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteWechatRobotGroup,
    data: formData,
  })
}

export const addWechatRobotGroup = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addWechatRobotGroup,
    data: parameter,
  })
}

export const statisticalMagnitude = () => {
  return request({
    method: 'post',
    url: Api.statisticalMagnitude,
  })
}

export const wechatRobotAddGroup = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.wechatRobotAddGroup,
    data: parameter,
  })
}

export const wechatRobotAddGroupEditName = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editGroup,
    data: parameter,
  })
}

export const getUserBalanceRecordList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getUserBalanceRecordList,
    data: parameter,
  })
}

export const getUserBalance = () => {
  return request({
    method: 'post',
    url: Api.getUserBalance,
  })
}

export const getFishRobotList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.getFishRobotList,
    data: parameter,
  })
}

export const getFishRobotGroupList = () => {
  return request({
    method: 'post',
    url: Api.getFishRobotGroupList,
  })
}

export const addFishRobotGroup = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addFishRobotGroup,
    data: parameter,
  })
}

export const deleteFishRobotGroup = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.deleteFishRobotGroup,
    data: formData,
  })
}

export const editFishRobotGroup = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editFishRobotGroup,
    data: parameter,
  })
}

export const editFishRobotRemark = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.editFishRobotRemark,
    data: parameter,
  })
}

export const fishRobotAddGroup = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.fishRobotAddGroup,
    data: parameter,
  })
}

export const fishStatisticalMagnitude = () => {
  return request({
    method: 'post',
    url: Api.fishStatisticalMagnitude,
  })
}

export const auth = () => {
  return request({
    method: 'post',
    url: Api.auth,
  })
}

export const getAuthResult = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('taskId', parameter.taskId)
  return request({
    method: 'get',
    url: `${Api.getAuthResult}/${parameter.taskId}`,
    data: formData,
  })
}

export const openCard = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.openCard,
    data: parameter,
  })
}

export const AddMoney = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.addMoney,
    data: parameter,
  })
}
